home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / DefaultStyledDocument$AttributeUndoableEdit.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  1.3 KB  |  37 lines

  1. package javax.swing.text;
  2.  
  3. import javax.swing.undo.AbstractUndoableEdit;
  4. import javax.swing.undo.CannotRedoException;
  5. import javax.swing.undo.CannotUndoException;
  6.  
  7. public class DefaultStyledDocument$AttributeUndoableEdit extends AbstractUndoableEdit {
  8.    protected AttributeSet newAttributes;
  9.    protected AttributeSet copy;
  10.    protected boolean isReplacing;
  11.    protected Element element;
  12.  
  13.    public DefaultStyledDocument$AttributeUndoableEdit(Element var1, AttributeSet var2, boolean var3) {
  14.       this.element = var1;
  15.       this.newAttributes = var2;
  16.       this.isReplacing = var3;
  17.       this.copy = var1.getAttributes().copyAttributes();
  18.    }
  19.  
  20.    public void redo() throws CannotRedoException {
  21.       super.redo();
  22.       MutableAttributeSet var1 = (MutableAttributeSet)this.element.getAttributes();
  23.       if (this.isReplacing) {
  24.          var1.removeAttributes(var1);
  25.       }
  26.  
  27.       var1.addAttributes(this.newAttributes);
  28.    }
  29.  
  30.    public void undo() throws CannotUndoException {
  31.       super.undo();
  32.       MutableAttributeSet var1 = (MutableAttributeSet)this.element.getAttributes();
  33.       var1.removeAttributes(var1);
  34.       var1.addAttributes(this.copy);
  35.    }
  36. }
  37.